package Clojure

import (
	"fmt"
	. "misc/Clojure/parse"
)

type IFucntion interface {
	Call([]Node, *Context) Node
}

type NativeFunction struct {
	MyFunction func([]Node, *Context) Node
}

func (n *NativeFunction) Call(lst []Node, context *Context) Node {
	return n.MyFunction(lst, context)
}
func (n NativeFunction) Position() *Pos {

	return nil
}

func (n NativeFunction) String() string {
	return "NativeFunction"
}

func (n NativeFunction) Children() []Node {
	return nil
}

func _log(args []Node, context *Context) Node {
	args = EvalArgs(args, context)
	arg0 := args[0]
	switch arg0.(type) {
	case *StringNode:
		fmt.Println(arg0.(*StringNode).Val)
	case *NumberNode:
		fmt.Println(arg0.(*NumberNode).Val)
	}
	return nil
}
